package com.woniuxy.propertyjava.service.impl;

import com.woniuxy.propertyjava.dao.RepairDao;
import com.woniuxy.propertyjava.entity.PageBean;
import com.woniuxy.propertyjava.entity.Repair;
import com.woniuxy.propertyjava.service.RepairService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class RepairServiceImpl implements RepairService {
    @Resource
    RepairDao repairDao;
    @Override
    public PageBean<Repair> getRepairByPage(int pageIndex, int pageSize, Repair repair) {
        PageBean<Repair> pageBean=new PageBean<>();
        pageBean.setPageIndex(pageIndex);
        pageBean.setPageSize(pageSize);
        pageBean.setBeanList(repairDao.selectRepairByPage(pageIndex, pageSize, repair));
        pageBean.setTotalRecode(repairDao.selectRepairByPageCount(repair));
        return pageBean;
    }

    @Override
    public int getRepairByPageCount(Repair repair) {
        return repairDao.selectRepairByPageCount(repair);
    }

    @Override
    public void insertRepair(Repair repair) {
        repairDao.insertRepair(repair);
    }

    @Override
    public void deletRepair(int repairid) {
        repairDao.deletRepair(repairid);
    }

    @Override
    public void updateRepair(Repair repair) {
        repairDao.updateRepair(repair);
    }
}
